home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / tmp / customization-scripts / customize_iso < prev    next >
Text File  |  2009-02-04  |  4KB  |  86 lines

  1. #!/bin/bash
  2.  
  3. ###################################################################################
  4. # UCK - Ubuntu Customization Kit                                                  #
  5. # Copyright (C) 2006-2009 UCK Team                                                #
  6. #                                                                                 #
  7. # UCK is free software: you can redistribute it and/or modify                     #
  8. # it under the terms of the GNU General Public License as published by            #
  9. # the Free Software Foundation, either version 3 of the License, or               #
  10. # (at your option) any later version.                                             #
  11. #                                                                                 #
  12. # UCK is distributed in the hope that it will be useful,                          #
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of                  #
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                   #
  15. # GNU General Public License for more details.                                    #
  16. #                                                                                 #
  17. # You should have received a copy of the GNU General Public License               #
  18. # along with UCK.  If not, see <http://www.gnu.org/licenses/>.                    #
  19. ###################################################################################
  20.  
  21. BUILD_DIR=`mktemp -d`
  22.  
  23. function failure()
  24. {
  25.     echo "$@"
  26.     exit 1
  27. }
  28.  
  29. SCRIPT_DIR=`dirname "$0"`
  30. BOOT_LANG=`cat "$SCRIPT_DIR/livecd_locale"`
  31. REMASTER_HOME=$1
  32. ISO_REMASTER_DIR="$REMASTER_HOME/remaster-iso"
  33. REMASTER_DIR="$REMASTER_HOME/remaster-root"
  34.  
  35. pushd "$BUILD_DIR" || failure "Cannot change directory to $BUILD_DIR, error=$?"
  36. if [ -e "$REMASTER_DIR"  ]; then
  37.     cp -f /etc/resolv.conf "$REMASTER_DIR/etc/resolv.conf" || failure "Failed to copy resolv.conf to image directory, error=$?"
  38.     cp -a "$SCRIPT_DIR/download-gfxboot-theme-ubuntu" "$REMASTER_DIR/tmp"
  39.     chroot "$REMASTER_DIR" /tmp/download-gfxboot-theme-ubuntu || failure "Failed to fetch gfxboot-theme-ubuntu source, check if you have deb-src line enabled for repository main in /etc/apt/sources.list, error=$?"
  40.     mv "$REMASTER_DIR/tmp/gfxboot-theme-ubuntu" "$BUILD_DIR"
  41.     chroot "$REMASTER_DIR" rm /etc/resolv.conf /tmp/download-gfxboot-theme-ubuntu /tmp/gfxboot*
  42. else
  43.     apt-get source gfxboot-theme-ubuntu || failure "Failed to fetch gfxboot-theme-ubuntu source, check if you have deb-src line enabled for repository main in /etc/apt/sources.list, error=$?"
  44. fi
  45.  
  46. cd gfxboot-theme-ubuntu*/
  47.  
  48. LIVECD_LANGS=`cat "$SCRIPT_DIR/language_packs"`
  49. LANGPACKS_CONCATENATED=""
  50.  
  51. for LANGPACK in $LIVECD_LANGS; do
  52.     if [ -z "$LANGPACKS_CONCATENATED" ]; then
  53.         LANGPACKS_CONCATENATED="$LANGPACK"
  54.     else
  55.         LANGPACKS_CONCATENATED="$LANGPACKS_CONCATENATED|$LANGPACK"
  56.     fi
  57. done
  58.  
  59. make DEFAULT_LANG="$BOOT_LANG" || failure "Failed to build gfxboot theme, error=$?"
  60. pushd boot
  61. #fix list of languages to contain all languages for which there are language packs on CD
  62. ls -1 *.tr | while read i ; do echo $(basename $i .tr) ; done | grep -E "^($LANGPACKS_CONCATENATED)\>(_.*)?" >langlist
  63. popd
  64.  
  65. cp -af boot/* "$ISO_REMASTER_DIR/isolinux/" || failure "Error while copying boot files ( " boot/* " ) to $ISO_REMASTER_DIR/isolinux/, error=$?"
  66.  
  67. popd
  68.  
  69. if [ "$BUILD_DIR" = "/" ] ; then
  70.     failure "Trying to remove root dir"
  71. else
  72.     rm -rf "$BUILD_DIR"
  73. fi
  74.  
  75. #copy kernel and initrd, in case it was changed during installation
  76. VMLINUZ=`ls -1 "$REMASTER_DIR"/boot/vmlinuz* | sort | tail -n1`
  77. if [ "$VMLINUZ" != "" ]; then
  78.     INITRD="$REMASTER_DIR"/boot/initrd.img-$(echo `basename $VMLINUZ` | cut -d'-' -f 2-)
  79.     if [ -e "$VMLINUZ" -a -e "$INITRD" ]; then
  80.         echo "Updating kernel, kernel=$VMLINUZ, initrd=$INITRD"
  81.         cp -f "$VMLINUZ" "$ISO_REMASTER_DIR/casper/vmlinuz"
  82.         cp -f "$INITRD" "$ISO_REMASTER_DIR/casper/initrd.gz"
  83.     else
  84.         echo "Not updating kernel as initrd not present"
  85.     fi
  86. fi